﻿using Unity.Entities;
using UnityEngine;
using UnityEngine.Serialization;

namespace MyTanks
{
    public class MyTankTurretAuthoring : MonoBehaviour
    {
        [FormerlySerializedAs("ShellSpawnPoint")] public GameObject shellSpawnPoint;

        class Baker : Baker<MyTankTurretAuthoring>
        {
            public override void Bake(MyTankTurretAuthoring authoring)
            {
                var entity = GetEntity(TransformUsageFlags.None);
                AddComponent(entity, new Turret()
                {
                    shellSpawnPoint = GetEntity(authoring.shellSpawnPoint, TransformUsageFlags.Dynamic)
                });
            }
        }
    }


    public struct Turret : IComponentData
    {
        public Entity shellSpawnPoint;
    }
}